from sanic import Sanic
from sanic_session import Session,InMemorySessionInterface
from controller import userController, publicController, com_introController,\
        salesmanController, guestController, swineryController, contractController, deviceController

app=Sanic()
session=Session(app,interface=InMemorySessionInterface())

app.add_route(userController.zxzlhello,'/zxzlhello',version=1)

app.add_route(userController.userSignUp,'/signup',methods=['GET','POST','OPTIONS'])     # 注册路由
app.add_route(publicController.getSMSCode,'/getSMSCode/<tel>',methods=['GET'])         # 获取短信验证码路由
app.add_route(userController.loginSMSCode,'/loginSMSCode',methods=['POST'])           # 手机验证码登陆路由
app.add_route(userController.loginPasswd,'/loginPasswd',methods=['POST'])            # 手机号密码登陆路由
app.add_route(userController.findPasswd,'/findPasswd',methods=['POST'])             # 找回密码路由
app.add_route(userController.modifyUsername,'/modifyUsername/<tel>',methods=['POST'])    # 修改用户名路由
app.add_route(userController.modifyPasswd,'/modifyPasswd/<tel>',methods=['POST'])       # 修改密码路由
app.add_route(userController.modifyTel,'/modifyTel/<tel>',methods=['POST'])            # 修改手机号路由

app.add_route(com_introController.comintro,'/comintro',methods=['GET','POST'])          # 获取公司简介


# #################-孙宇峰-######################
app.add_route(salesmanController.salesman_management, '/salesman_management', methods=['GET', 'POST'])
app.add_route(salesmanController.add_salesman, '/add_salesman', methods=['GET', 'POST'])
app.add_route(salesmanController.edit_salesman, '/edit_salesman', methods=['GET', 'POST'])
app.add_route(salesmanController.delete_salesman, '/delete_salesman', methods=['GET', 'POST'])
app.add_route(salesmanController.salesman_dev_display, '/salesman_dev_display', methods=['GET', 'POST'])
app.add_route(salesmanController.salesman_add_dev, '/salesman_add_dev', methods=['GET', 'POST'])
app.add_route(salesmanController.salesman_delete_dev, '/salesman_delete_dev', methods=['GET', 'POST'])

app.add_route(guestController.guest_management, '/guest_management', methods=['GET', 'POST'])
app.add_route(guestController.guest, '/guest', methods=['GET', 'POST'])
app.add_route(guestController.guest_info, '/guest_info', methods=['GET', 'POST'])
app.add_route(guestController.add_guest, '/add_guest', methods=['GET', 'POST'])
app.add_route(guestController.edit_guest, '/edit_guest', methods=['GET', 'POST'])
app.add_route(guestController.delete_guest, '/delete_guest', methods=['GET', 'POST'])

app.add_route(swineryController.swinery_dev_list, '/swinery_dev_list', methods=['GET', 'POST'])
app.add_route(swineryController.swinery_add_dev, '/swinery_add_dev', methods=['GET', 'POST'])
app.add_route(swineryController.swinery_delete_dev, '/swinery_delete_dev', methods=['GET', 'POST'])

app.add_route(contractController.contract_dev, '/contract_dev', methods=['GET', 'POST'])
app.add_route(contractController.contract_add_dev, '/contract_add_dev', methods=['GET', 'POST'])

app.add_route(deviceController.device, '/device', methods=['GET', 'POST'])
# #################-孙宇峰-######################
